<template>
  <div>
      <p>{{birthdayFn()}}天</p>
  </div>
</template>

<script>
//封装一个函数, 代码里固定输入你的生日, 调用函数在页面显示你活了多少天
export default {
  data(){
      return{
          birthday:'1992-08-20'
      }
  },
  methods: {
     birthdayFn(){
         console.log(Date.now());
         let oldday = new Date(this.birthday).getTime();
      let newday = new Date().getTime();
      let days = Math.ceil((newday - oldday) / (1000 * 60 * 60 * 24));
      return days;
     } 
  }
}
</script>

<style>

</style>